import java.util.Arrays;
import java.util.Scanner;

public class Old_1097 {

	public static void main(String[] args) {
		Scanner sc = new Scanner(System.in);
		int sum = sc.nextInt();
		int num = sc.nextInt();
		int re = 0;
		int[] all = new int[num];
		for(int i = 0;i<num;i++) {
			all[i] = sc.nextInt();
		}
		Arrays.sort(all);
		int l = 0,r = num-1;
		for(int i = 0;i<num;i++) {
			while(true) {
				if(i>=r) {
					System.out.println(num-re);
					return;
				}
				if(all[i]+all[r]<=sum) {
					re++;
					r--;
					break;
				}
				r--;
			}
		}
	}

}
